<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新增权限</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link rel="stylesheet" type="text/css" href="${ctxPath}/static/police/css/common.css">
    <link rel="stylesheet" type="text/css" href="${ctxPath}/static/police/css/style.css">
</head>
<body>
<div class="embedLeft">
    <div class="breadcrumb">
        <span>权限管理</span>
        <span>角色列表</span>
        <b>新增权限</b>
    </div>
    <div class="embedRight">
        <form method="post" id="addPower" action="${ctxPath}/admin/role/save">
        <div class="manage_item">
            <div class="manage_line clearfix">
                <span class="label">权限名称</span>
                <div class="manage_int"><input placeholder="请输入权限名称" class="text" id="role" name="role" type="text"/></div>
            </div>
            <div class="manage_line clearfix">
                <span class="label">权限选择</span>
                <div class="manage_int2 table_Box">
                    <table width="100%">
                        <tr>
                            <th>序号</th>
                            <th>功能名称</th>
                            <th>操作</th>
                        </tr>
                        <tr>
                            <td>1</td>
                            <td>管理员列表</td>
                            <td class="operate">
                                <span class="role_item"><i class="i_check i_checked" data="1"></i><b>列表</b></span>
                                <span class="role_item"><i class="i_check"  data="2"></i><b>新增</b></span>
                                <span class="role_item"><i class="i_check"  data="3"></i><b>编辑</b></span>
                                <span class="role_item"><i class="i_check"  data="4"></i><b>删除</b></span>
                                <span class="role_item"><i class="i_check"  data="5"></i><b>重置密码</b></span>
                            </td>
                        </tr>
                        <tr>
                            <td>1</td>
                            <td>角色列表</td>
                            <td class="operate">
                                <span class="role_item"><i class="i_check i_checked"  data="6"></i><b>列表</b></span>
                                <span class="role_item"><i class="i_check"  data="7"></i><b>新增</b></span>
                                <span class="role_item"><i class="i_check"  data="8"></i><b>编辑</b></span>
                                <span class="role_item"><i class="i_check"  data="9"></i><b>删除</b></span>
                            </td>
                        </tr>
                        <tr>
                            <td>1</td>
                            <td>房东列表</td>
                            <td class="operate">
                                <span class="role_item"><i class="i_check i_checked"  data="10"></i><b>列表</b></span>
                            </td>
                        </tr>
                        <tr>
                            <td>1</td>
                            <td>租户列表</td>
                            <td class="operate">
                                <span class="role_item"><i class="i_check i_checked"   data="11"></i><b>列表</b></span>
                            </td>
                        </tr>
                        <tr>
                            <td>1</td>
                            <td>房屋列表</td>
                            <td class="operate">
                                <span class="role_item"><i class="i_check i_checked"  data="12"></i><b>列表</b></span>
                            </td>
                        </tr>
                        <tr>
                            <td>1</td>
                            <td>居住证列表</td>
                            <td class="operate">
                                <span class="role_item"><i class="i_check i_checked" data="13"></i><b>列表</b></span>
                                <span class="role_item"><i class="i_check" data="14"></i><b>受理</b></span>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <button class="blueBtn ml16 mt90"  type="submit" >确认</button>
        </div>
        </form>
    </div>
</div>
<script type="text/javascript" src="${ctxPath}/static/police/js/jquery-1.11.1.min.js"></script>
<script src="${ctxPath}/static/blade/js/blade-toolbox.js" type="text/javascript"></script>
<script src="${ctxPath}/static/blade/js/blade-ajax.js" type="text/javascript"></script>
<script src="${ctxPath}/static/layer/layer.js"></script>
<script type="text/javascript" src="${ctxPath}/static/police/js/base.js"></script>

<script type="text/javascript">
    // 登录
    $("form").submit(function(){
        var item = new Array();
        $(".i_check").each(function(){
            if($(this).hasClass("i_checked")){
                item.push(parseInt($(this).attr("data")));
            }
        });
        if($("#role").val() == ""){
            alert("请输入角色名称");
            return false;
        }
        var items = item.join(",");
        if(item.length == 0){
            alert("请选择权限");
            return false;
        }
        var $form = $(this);
        var ajax = new Ajax($form.attr("action"), function(data){
            if (data.code === 0) {
                layer.msg(data.message, {shift: 1});
                setTimeout(function(){$("#iframepage", parent.document).attr("src","${ctxPath}/admin/role/");}, 1200);
                return false;
            } else {
                layer.msg(data.message, {shift: 6});
                return false;
            }
        });
        ajax.data = $form.serialize()+"&item="+items;
        ajax.start();

        return false;
    });
</script>
</body>
</html>